package com.vincent.kdp.presenter;

import android.content.Intent;

import com.vincent.baseapp.base.BasePresenter;
import com.vincent.kdp.adapter.MyGlideImageLoader;
import com.vincent.kdp.contract.NewChildContract;
import com.youth.banner.Banner;
import com.youth.banner.BannerConfig;
import com.youth.banner.Transformer;
import com.youth.banner.listener.OnBannerListener;

import java.util.ArrayList;

/**
 * Created by jingjing on 2017/4/17.
 */

public class NewChildPresenter extends BasePresenter<NewChildContract.View> implements NewChildContract.Presenter {



    @Override
    public void initView(Intent intent) {

    }


    @Override
    public void autoScrollow(Banner mNewBanner, ArrayList<String> list) {
        //设置banner样式
        mNewBanner.setBannerStyle(BannerConfig.CIRCLE_INDICATOR);
        //设置图片加载器
        mNewBanner.setImageLoader(new MyGlideImageLoader());

        //设置图片集合
        mNewBanner.setImages(list);

        //设置banner动画效果
        mNewBanner.setBannerAnimation(Transformer.Default);

        //设置自动轮播，默认为true
        mNewBanner.isAutoPlay(true);
        //设置轮播时间
        mNewBanner.setDelayTime(3000);
        //设置指示器位置（当banner模式中有指示器时）

        mNewBanner.setIndicatorGravity(BannerConfig.CENTER);
        //banner设置方法全部调用完毕时最后调用
        mNewBanner.setOnBannerListener(new OnBannerListener() {
            @Override
            public void OnBannerClick(int position) {
                mView.clickPosition(position);
            }
        });
        mNewBanner.start();
    }
}
